﻿//--------------------------------------------------------------------------------------------------------------
// <copyright file="CSPAuxiliaryMenu.cs" company="Microsoft Corporation" author="David Sanchez" date="01/01/2008">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//--------------------------------------------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using System.Collections;
using System.Reflection;
using System.ComponentModel;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Publishing;

using CSP.Core;

namespace CSP.WebParts
{
    /// <summary>
    /// This webpart gets the pages of the root subsite
    /// </summary>
    [Guid("10C36385-DA25-44e3-961A-567AD76A62D8")]
    public class CSPAuxiliaryMenu : BaseWebPart
    {

        /// <summary>
        /// Constructor
        /// </summary>
        public CSPAuxiliaryMenu()
        {
            this.ExportMode = WebPartExportMode.All;
        }

        /// <summary>
        /// Fired on page create child control, loads the ASCX file
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            try
            {
                this.Hidden = false;

                UserControls.CSPAuxiliaryMenuWUC control = (UserControls.CSPAuxiliaryMenuWUC)Page.LoadControl(WebPartConstants.CSPAuxiliaryMenuWUC);
                control.WrapperWebPart = this;
                this.Controls.Add(control);
               

            }
            catch (CSP.Core.CSPException cspex)
            {
                errors.Add(this.LoadResource(WebPartConstants.CSPGenericErrorMessage));
            }
            catch (Exception ex)
            {
                this.LogMessage(this.LoadResource(WebPartConstants.CSPLoadControlErrorMessage), this.GetType().Name, ex);
                errors.Add(this.LoadResource(WebPartConstants.CSPGenericErrorMessage));
            }
        }
    }
}
